<%@page import="com.entity.Goal"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="top.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>编辑目标</title>
  </head>
  
  <body>
  
		<%
			Goal goal=(Goal)session.getAttribute("goal");
		
		%>
    
    <div class="container well" style="width:800px">
		<h1>编辑目标</h1>
		
		<div>
			<form action="updategoal.jspx" method="post" id="form" class="form-horizontal well">
				<div class="form-inline">
					<label>目标名称</label><br>
					<input id="input01" style="height:30px" type="text" class="input-xlarge" value="<%=goal.getName() %>" placeholder="请输入目标名称" name = "goalName">
					<span style="color:red" id="input01_msg"></span>
				</div>
				
				<br /><br />
				<label>目标描述</label>
				<textarea rows="3" id="input02" class="span7"  placeholder="请输入目标的描述" name = "goalDesc"><%=goal.getDesc() %></textarea>
				<span style="color:red" id="input02_msg"></span>
				<br /><br />
		
				<div class="form-actions">
					<button class="btn btn-primary" type="submit">保存目标</button>
					<a class="btn" href="goal.jspx">取消</a>
				</div>
				
			</form>
		</div>
	</div>
    <script type="text/javascript">
		document.getElementById("form").onsubmit=function(){
			
			var input01 = document.getElementById("input01").value;
			var input02 = document.getElementById("input02").value;
			
			if(input01.trim() == "") {
				document.getElementById("input01_msg").innerHTML = "请输入目标名称";
				document.getElementById("input01").focus();
				return false;
			}
				if(input02.trim() == "") {
				
				document.getElementById("input02_msg").innerHTML = "请输入目标描述";
				document.getElementById("input02").focus();
				return false;
			}
			
		};
		
		document.getElementById("input01").onblur = function(){
		
			var input01 = document.getElementById("input01").value;
			if(input01.trim() == "") {
				document.getElementById("input01").value = "";
				document.getElementById("input01_msg").innerHTML = "请输入目标名称";
				document.getElementById("input01").focus();
			}else{
				document.getElementById("input01_msg").innerHTML = "";
			}
		};
		document.getElementById("input02").onblur = function(){
		
			var input02 = document.getElementById("input02").value;
			if(input02.trim() == "") {
				document.getElementById("input02").value = "";
				document.getElementById("input02_msg").innerHTML = "请输入目标";
				document.getElementById("input02").focus();
			}else{
				document.getElementById("input02_msg").innerHTML = "";
			}
		};
		
		document.getElementById("input01").onkeydown = function(){
			document.getElementById("input01_msg").innerHTML = "";
		};
		document.getElementById("input02").onkeydown = function(){
			document.getElementById("input02_msg").innerHTML = "";
		};
	
	</script>
  </body>
</html>
